#!/usr/bin/env python
import wx
import wx.lib.buttons as buttons
import hd
import wx.html



class RefactorExample(wx.Frame):
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'NAIMATH : Medical Expert System',
                size=(1200, 800))

# Splash Screen
        image = wx.Image("splash.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()        
        wx.SplashScreen(image, wx.SPLASH_CENTRE_ON_SCREEN |wx.SPLASH_TIMEOUT, 1000, None, -1)
        wx.Yield()

                
        self.panel = wx.Panel(self, -1)
        self.panel.SetBackgroundColour("White")
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.panel.SetSizer(hbox1)

        self.panel1=wx.Panel(self.panel,-1)
        self.panel1.SetSize((300,800))

#--Panel 1 starts here :
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        self.panel1.SetSizer(vbox1)

        # Window for symptoms
        self.panel10=wx.Panel(self.panel1,-1)
        self.panel10.SetSize((300,300))

        hbox10=wx.BoxSizer(wx.HORIZONTAL)

        # Panel with labels and buttons "SYMPTOMS" start here --
        
        self.panelx1=wx.Panel(self.panel1,-1)
        self.panelx1.SetBackgroundColour('lightgray')
        hboxx1=wx.BoxSizer(wx.HORIZONTAL)


        b=buttons.GenButton(self.panelx1,-1,'Entered Symptoms:')
        b.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD, False))
        b.SetBackgroundColour("#190436")
        b.SetForegroundColour("white")
        b.SetToolTipString("List of symptoms entered so far shown below, check those which you wish to edit/delete and click on the button to the right ")
        hboxx1.Add(b,1,wx.RIGHT)


        bmp = wx.Image("edit.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button1 = wx.BitmapButton(self.panelx1, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button1.SetBackgroundColour('#190436')
        button1.SetToolTipString("Edit Symptoms")
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button1)                        
        hboxx1.Add(button1)
        
        bmp = wx.Image("delete.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button2 = wx.BitmapButton(self.panelx1, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button2.SetBackgroundColour('#190436')
        button2.SetToolTipString("Delete Symptoms") 
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button2)                              
        hboxx1.Add(button2)
        
        bmp = wx.Image("show.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button3 = wx.BitmapButton(self.panelx1, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button3.SetBackgroundColour('#190436')
        button3.SetToolTipString("Symptoms Browser")  
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button3)                                     
        hboxx1.Add(button3)                
        
        self.panelx1.SetSizer(hboxx1)
        vbox1.Add(self.panelx1,0,flag=wx.EXPAND | wx.RIGHT)

        # Panel with label and buttons ends here. Scrolled window begins....
        
        self.scroll10=wx.ScrolledWindow(self.panel10, -1, pos=wx.DefaultPosition,size=(300,210),style=wx.HSCROLL )
        self.scroll10.SetScrollbars(1,1,1300,1400)
        self.scroll10.SetBackgroundColour('lightgray')             
        hbox10.Add(self.scroll10, 1,flag=wx.EXPAND)
        self.panel10.SetSizer(hbox10)
        vbox1.Add(self.panel10,1,flag=wx.EXPAND)

        # Add widgets for symptoms window below-

        self.givenSymptoms = ['Headache Onset: Sudden', 'Headache Duration: 2 months', 'Headache Site: Unilateral', 'Headache Location: Temporal', 'Headache Aggravating factors: Music, Noise ', 'Headache Episodic: Yes ',
              'Fever: No', 'Difficulty in moving neck: No', 'History of head trauma: Yes', 'Vision difficulty: Yes', 'See Zigzag bright lines?: No ', 'Vomiting: No',
              'Nausea: Yes', 'Relieved by pain medications: Yes', 'Stress in life: No']

        self.symptomsbox()

# Problem with adding boxsizer in scrolled window. 2. GenButton on expansion shows the border twice. 
        
        # Window for signs

        # Panel with label SIGNS AND INVESTIGATION begins here --
        
        self.panelx2=wx.Panel(self.panel1,-1)
        self.panelx2.SetBackgroundColour('lightgray')
        hboxx2=wx.BoxSizer(wx.HORIZONTAL)


        b2=buttons.GenButton(self.panelx2,-1,'Signs and Investigations:')
        b2.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD, False))
        b2.SetBackgroundColour("#190436")
        b2.SetForegroundColour("white")
        b2.SetToolTipString("Below is the list of signs and investigations you entered, select them and click on buttons on the right to edit or delete them")
        hboxx2.Add(b2,1,wx.RIGHT)


        bmp = wx.Image("edit.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button1 = wx.BitmapButton(self.panelx2, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button1.SetBackgroundColour('#190436')        
        button1.SetToolTipString("Edit Signs/Investigations")
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button1)                       
        hboxx2.Add(button1)
        
        bmp = wx.Image("delete.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button2 = wx.BitmapButton(self.panelx2, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button2.SetBackgroundColour('#190436')             
        button2.SetToolTipString("Delete Signs/Investigations")                 
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button2)         
        hboxx2.Add(button2)
        
        bmp = wx.Image("show.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button3 = wx.BitmapButton(self.panelx2, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button3.SetBackgroundColour('#190436')               
        button3.SetToolTipString("Sign/Investigation Browser")               
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button3)         
        hboxx2.Add(button3)                
        
        self.panelx2.SetSizer(hboxx2)
        vbox1.Add(self.panelx2,0,flag=wx.EXPAND | wx.RIGHT)
        # Panel with label ends here. Now is the scrolled window.

        self.panel11=wx.Panel(self.panel1,-1)
        self.panel11.SetSize((300,300))
        hbox11=wx.BoxSizer(wx.HORIZONTAL)

       
        self.scroll=wx.ScrolledWindow(self.panel11,-1,pos=wx.DefaultPosition,size=(300,210), style=wx.HSCROLL | wx.VSCROLL)
        self.scroll.SetScrollbars(1,1,1300,1400)
        self.scroll.SetBackgroundColour('lightgray')             
        hbox11.Add(self.scroll, 1,flag=wx.EXPAND)
        self.panel11.SetSizer(hbox11)
        vbox1.Add(self.panel11,1,flag=wx.EXPAND)

        # Add widgets for signs below:

        self.givenSigns = ['Head Inspection: Bruise on left temporal region', 'Eye Examination: Normal','HEENT Exam: Normal' ,'Cardiovascular Exam: Normal', 'Respiratory Exam: Normal', 'GIT Exam: Normal ', 'CNS Examination: Abnormal ',
              'Weakness: Right Upper Limb Grade 4/5, Right Lower Limb 3/5', 'Sensations: Normal', 'Deep Tendon Reflexes: Normal', 'Gait and Posture: Normal', 'Higher Cerebral Functions: Normal', 'Mental Examination: Normal',
           'Exam of Genitalia: Normal', 'INV_Hemoglobin: 9.5%','INV_Blood Glucose: 120 mg/dl']
        self.signsbox()
        
        #Scrolled window 3: For investigations

        # Panel with label TODO INVESTIGATIONS begins --
        self.panelx3=wx.Panel(self.panel1,-1)
        self.panelx3.SetBackgroundColour('lightgray')
        hboxx3=wx.BoxSizer(wx.HORIZONTAL)


        b3=buttons.GenButton(self.panelx3,-1,'To-Do Investigations:')
        b3.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD, False))
        b3.SetBackgroundColour("#3373ae")
        b3.SetForegroundColour("white")
        b3.SetToolTipString("Below are the investigations required listed along with importance and costs. Select them and use the buttons to the right to Order an investigation or Read more about it")
        hboxx3.Add(b3,1,wx.RIGHT)


        bmp = wx.Image("order.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button1 = wx.BitmapButton(self.panelx3, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button1.SetBackgroundColour('#3373ae') 
        button1.SetToolTipString("Order and Feed Results")                     
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button1)         
        hboxx3.Add(button1)
        
        bmp = wx.Image("invinfo.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button2 = wx.BitmapButton(self.panelx3, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button2.SetBackgroundColour('#3373ae')        
        button2.SetToolTipString("Read more about the investigation(s)")              
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button2)         
        hboxx3.Add(button2)
        
        bmp = wx.Image("show.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button3 = wx.BitmapButton(self.panelx3, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button3.SetBackgroundColour('#3373ae')        
        button3.SetToolTipString("Investigations Browser")              
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button3)         
        hboxx3.Add(button3)                
        
        self.panelx3.SetSizer(hboxx3)
        vbox1.Add(self.panelx3,0,flag=wx.EXPAND | wx.RIGHT)

        # End of labels.Scrolled window begins
        
        self.panel12=wx.Panel(self.panel1,-1)
        self.panel12.SetSize((300,300))
        hbox12=wx.BoxSizer(wx.HORIZONTAL)


        
        self.scroll1=wx.ScrolledWindow(self.panel12,-1,pos=wx.DefaultPosition, size=(300,200), style=wx.HSCROLL | wx.VSCROLL)
        self.scroll1.SetScrollbars(1,1,1300,1400)
        hbox12.Add(self.scroll1, 1,flag=wx.EXPAND)
        self.panel12.SetSizer(hbox12)
        vbox1.Add(self.panel12, 1, flag=wx.EXPAND)
        self.scroll1.SetBackgroundColour('lightgray')             

        #Add widgets for investigationdone below:

        self.todoinv = ['INV_CT Scan Head: 90% Useful, Cost: 3550Rs','INV_Complete blood picture: 90% Useful, Cost: 50Rs', 'INV_X ray Head: 90% Useful, Cost: 250Rs','INV_EEG:70% Useful, Cost: 300Rs','INV_ECG: 70% Useful, Cost: 150Rs', 'INV_Complete Urine Examination: 60% Useful, Cost: 50Rs']
        self.Invbox()


#-- End of Panel 1. Start of Panel 2...

        self.panel2=wx.Panel(self.panel,-1)
        self.panel2.SetBackgroundColour("White")
        self.panel2.SetSize((420,800))

        hbox21=wx.BoxSizer(wx.HORIZONTAL)
        vbox21=wx.BoxSizer(wx.VERTICAL)

        self.panel2.SetSizer(vbox21)

        # Panel with label ANSWER THE QUESTIONS

        self.panelx22=wx.Panel(self.panel2,-1)
        self.panelx22.SetBackgroundColour('lightgray')
        hboxx22=wx.BoxSizer(wx.HORIZONTAL)


        b4=buttons.GenButton(self.panelx22,-1,'Please answer the questions below:')
        b4.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD, False))
        b4.SetBackgroundColour("#3373ae")
        b4.SetForegroundColour("white")
        b4.SetToolTipString("Use the buttons on the right to control the session.")
        hboxx22.Add(b4,1,wx.RIGHT)


        bmp = wx.Image("finish.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button1 = wx.BitmapButton(self.panelx22, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button1.SetBackgroundColour('#3373ae')        
        button1.SetToolTipString("Finish the session")
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button1)                 
        hboxx22.Add(button1)
        
        bmp = wx.Image("new.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button2 = wx.BitmapButton(self.panelx22, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button2.SetBackgroundColour('#3373ae')        
        button2.SetToolTipString("Start a New Session") 
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button2)                        
        hboxx22.Add(button2)
        
        bmp = wx.Image("edit.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button3 = wx.BitmapButton(self.panelx22, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button3.SetBackgroundColour('#3373ae')
        button3.SetToolTipString("Edit the questions")
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button3)                                 
        hboxx22.Add(button3)  

        bmp = wx.Image("load.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button4 = wx.BitmapButton(self.panelx22, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button4.SetBackgroundColour('#3373ae')        
        button4.SetToolTipString("Load a casesheet")  
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button4)                       
        hboxx22.Add(button4)   

        bmp = wx.Image("show.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button5 = wx.BitmapButton(self.panelx22, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button5.SetBackgroundColour('#3373ae')    
        button5.SetToolTipString("Question Browser")  
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button5)                           
        hboxx22.Add(button5)                                 
        
        self.panelx22.SetSizer(hboxx22)
        vbox21.Add(self.panelx22,0,flag=wx.EXPAND | wx.RIGHT)

        vbox21.Add(hbox21, 1, flag=wx.EXPAND)

     
        self.scroll21=wx.ScrolledWindow(self.panel2,-1,pos=wx.DefaultPosition,size=(420,620), style=wx.HSCROLL | wx.VSCROLL)
        self.scroll21.SetScrollbars(1,1,2500,2900)
        self.scroll21.SetBackgroundColour("White")
        hbox21.Add(self.scroll21,1,flag=wx.EXPAND)

        # Add widgets of panel2 main question area below:
###############################################################################################
               
        pos=(10,20)
        cf=0.8
        cf2=0.6
        pos=hd.hd_onset(self,pos,str(cf))
        pos=hd.hd_location(self,pos,cf2)
        pos=hd.hd_duration(self,pos,cf2)
        pos=hd.hd_episodic(self,pos,cf2)
#-- End of Panel 2 and start of Panel 3.

        self.panel3=wx.Panel(self.panel,-1)
        self.panel3.SetSize((300,800))  
        
        vbox3=wx.BoxSizer(wx.VERTICAL)

        # Window for diagnosis list
        
        self.panel30=wx.Panel(self.panel3,-1)
        self.panel30.SetSize((300,300))

        hbox30=wx.BoxSizer(wx.HORIZONTAL)
        


        # Panel with label DIAGNOSIS begins --
        self.panelx31=wx.Panel(self.panel3,-1)
        self.panelx31.SetBackgroundColour('lightgray')
        hboxx31=wx.BoxSizer(wx.HORIZONTAL)


        b5=buttons.GenButton(self.panelx31,-1,"Probable Diagnosis': ")
        b5.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD, False))
        b5.SetBackgroundColour("#ae335c")
        b5.SetForegroundColour("white")
        b5.SetToolTipString("Select a diagnosis and click on the button to the right to work on them")
        hboxx31.Add(b5,1,wx.RIGHT)


        bmp = wx.Image("fix.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button1 = wx.BitmapButton(self.panelx31, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button1.SetBackgroundColour('#ae335c')        
        button1.SetToolTipString("Freeze this diagnosis and proceed to Management")                
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button1)         
        hboxx31.Add(button1)
        
        bmp = wx.Image("exclusive.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button2 = wx.BitmapButton(self.panelx31, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button2.SetBackgroundColour('#ae335c')        
        button2.SetToolTipString("Ask questions only related to the selected diagnosis")                
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button2)         
        hboxx31.Add(button2)
        
        bmp = wx.Image("help.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button3 = wx.BitmapButton(self.panelx31, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button3.SetBackgroundColour('#ae335c')        
        button3.SetToolTipString("Information and Health Education regarding the selected diagnosis")                
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button3)         
        hboxx31.Add(button3)                
        
        self.panelx31.SetSizer(hboxx31)
        vbox3.Add(self.panelx31,0,flag=wx.EXPAND | wx.RIGHT)


        # End of diangosis label. Scrolled window begins

        self.scroll30=wx.ScrolledWindow(self.panel30, -1, pos=wx.DefaultPosition,size=(300,210))
        self.scroll30.SetScrollbars(1,1,1300,1400)
        hbox30.Add(self.scroll30, 1,flag=wx.EXPAND)
        self.panel30.SetSizer(hbox30)
        vbox3.Add(self.panel30,1,flag=wx.EXPAND)
        self.scroll30.SetBackgroundColour('lightgray') 

        # Widgets for diagnosis


        #WIndow for slider
        self.panel31=wx.Panel(self.panel3,-1)
        self.panel31.SetSize((300,30))
        vbox3.Add(self.panel31,0,flag=wx.EXPAND | wx.RIGHT)
        self.panel31.SetBackgroundColour('lightgray')
        slider = wx.Slider(self.panel31, 100, 60, 1, 100, pos=(0, 0),
        size=(250, -1),
        style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS )

        st_slider=wx.StaticText(self.panel31, -1, "Threshold (Low value = Better diagnosis\n .....but more questions!)", pos=(10,35))
        font1 = wx.Font(8, wx.DECORATIVE,wx.ITALIC, wx.NORMAL)
        st_slider.SetFont(font1)


        # Start of label EXPLANATION BOX:


        self.panelx32=wx.Panel(self.panel3,-1)
        self.panelx32.SetBackgroundColour('lightgray')
        hboxx32=wx.BoxSizer(wx.HORIZONTAL)


        b6=buttons.GenButton(self.panelx32,-1,'Explanation Box: ')
        b6.SetFont(wx.Font(10, wx.ROMAN, wx.NORMAL, wx.BOLD, False))
        b6.SetBackgroundColour("#3373ae")
        b6.SetForegroundColour("white")
        b6.SetToolTipString("Use the buttons on the right to interact")
        hboxx32.Add(b6,1,wx.RIGHT)


        bmp = wx.Image("edit.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button1 = wx.BitmapButton(self.panelx32, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button1.SetBackgroundColour('#3373ae')
        button1.SetToolTipString("Add a note to this explanation")                
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button1)         
        hboxx32.Add(button1)
        
        bmp = wx.Image("hi.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button2 = wx.BitmapButton(self.panelx32, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button2.SetToolTipString("Chat with Bruce! regarding health issues")                
        button2.SetBackgroundColour('#3373ae')
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button2)         
        hboxx32.Add(button2)
        
        bmp = wx.Image("show.png", wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        button3 = wx.BitmapButton(self.panelx32, -1, bmp, pos=(10, 20),size=(30,31),style=0)
        button3.SetBackgroundColour('#3373ae')
        button3.SetToolTipString("Show all explanations")                
        self.Bind(wx.EVT_BUTTON,self.OnCloseMe,button3)         
        hboxx32.Add(button3)                
        
        self.panelx32.SetSizer(hboxx32)
        vbox3.Add(self.panelx32,0,flag=wx.EXPAND | wx.RIGHT)
        


        
        # Window for bruce chat
        self.panel32=wx.Panel(self.panel3,-1)
        self.panel32.SetSize((300,300))


        hbox32=wx.BoxSizer(wx.HORIZONTAL)
        self.scroll32=wx.ScrolledWindow(self.panel32,-1,pos=wx.DefaultPosition,size=(300,210), style=wx.HSCROLL | wx.VSCROLL)
        self.scroll32.SetScrollbars(1,1,1300,1400)
        hbox32.Add(self.scroll32, 1,flag=wx.EXPAND)
        self.panel32.SetSizer(hbox32)
        vbox3.Add(self.panel32,1,flag=wx.EXPAND)
        self.panel3.SetSizer(vbox3)        
        self.scroll32.SetBackgroundColour('lightgray')

        # Add widgets to bruces info box


#--End of Panel3
         
        hbox1.Add(self.panel1,1,flag=wx.EXPAND)     
        hbox1.Add(self.panel2,2,flag=wx.EXPAND)
        hbox1.Add(self.panel3,1,flag=wx.EXPAND)        

        # Create Menubar
        self.createMenuBar() 

        # Status Bar
        self.CreateStatusBar()
        self.SetStatusText("This is the statusbar")
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) # Close window function


         
    def menuData(self):
        return (("&File",
                            ("&Open", "Open in status bar", self.OnOpen),
                            ("&Quit", "Quit", self.OnCloseWindow)),
                        ("&Edit",
                            ("&Copy", "Copy", self.OnCopy),
                            ("C&ut", "Cut", self.OnCut),
                            ("&Paste", "Paste", self.OnPaste),
                            ("", "", ""),
                            ("&Options...", "DisplayOptions", self.OnOptions)), ("&Help", ("&About", "About", self.OnAbout)))
    def createMenuBar(self):
       menuBar = wx.MenuBar()
       for eachMenuData in self.menuData():
            menuLabel = eachMenuData[0]                             
            menuItems = eachMenuData[1:]
            menuBar.Append(self.createMenu(menuItems), menuLabel)
       self.SetMenuBar(menuBar)
    def createMenu(self, menuData):
       menu = wx.Menu()
       for eachLabel, eachStatus, eachHandler in menuData:
            if not eachLabel:
                menu.AppendSeparator()
                continue
            menuItem = menu.Append(-1, eachLabel, eachStatus)
            self.Bind(wx.EVT_MENU, eachHandler, menuItem)
       return menu

    def OnCloseWindow(self,event):
        self.Destroy()
    def OnOpen(self,event):
        pass
    def OnCopy(self,event):
        pass    
    def OnCut(self,event):
        pass
    def OnPaste(self,event):
        pass   
    def OnOptions(self,event):
        pass




    def OnAbout(self,event):
        dlg = SketchAbout(self)
        dlg.ShowModal()
        dlg.Destroy()            
        
        
    def symptomsbox(self):
        self.GenChecks(self.givenSymptoms,self.scroll10)

    def signsbox(self):
        self.GenChecks(self.givenSigns, self.scroll)
    def Invbox(self):
        self.GenChecks(self.todoinv, self.scroll1)
                
    def GenChecks(self,lists,panel):
        x=0
        y=5
        for i in lists:
            checkbox = wx.CheckBox(panel,-1,i,(10,y))
            y=y+20

    def OnCloseMe(self,event):
        pass          
        
class SketchAbout(wx.Dialog):
    def __init__(self,parent):
        wx.Dialog.__init__(self, parent, -1, 'About Naimath',
                          size=(440, 400) )
        html = wx.html.HtmlWindow(self)
        self.text='''<html>
<body bgcolor="#ACAA60">
<center><table bgcolor="#455481" width="100%" cellspacing="0"
cellpadding="0" border="1">
<tr>
     <td align="center"><h1>Naimath v 1.0 </h1></td>
</tr>
</table>
</center>
<p><b>Naimath Medical Expert System</b> is an experimental cum demonstration program for
<b>rule based clinical decision support system.</b>
We donot take any liabilities for damage caused by the use of this software.
This software is not to replace professional medical advice but rather to supplement it.
</p>
<p><b>Naimath</b> and <b>Pyke Engine</b> are brought to you by
<b>Bruce Fredericksen</b> and <b> <br> Dr. Inayathullah Ghori</b> <br> Copyright
&copy; 2010-2011.</p>
</body>
</html>
'''
        html.SetPage(self.text)
        button = wx.Button(self, wx.ID_OK, "Okay")
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(html, 1, wx.EXPAND|wx.ALL, 5)
        sizer.Add(button, 0, wx.ALIGN_CENTER|wx.ALL, 5)
        self.SetSizer(sizer)
        self.Layout()

def run(rule_base = None, canned_questions = None):
    app = wx.PySimpleApp()
    frame = RefactorExample(parent=None, id=-1)
    frame.Show()
    app.MainLoop()

if __name__ == '__main__':
    run()

    # How do I get child items of a panel/scrolled pane - list all checkboxes and then see how many are marked true. Get there labels. Dictionary check. Work on them.

